package com.app.biz.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.app.biz.mapper.AppVersionMapper;
import com.app.biz.domain.formal.AppVersion;
import com.app.biz.service.IAppVersionService;

/**
 * app版本Service业务层处理
 *
 * @author SangGuangCan
 * @date 2024-01-06
 */
@Service
public class AppVersionServiceImpl implements IAppVersionService
{
    @Autowired
    private AppVersionMapper appVersionMapper;

    /**
     * 查询app版本
     *
     * @param baseId app版本主键
     * @return app版本
     */
    @Override
    public AppVersion selectAppVersionByBaseId(String baseId)
    {
        return appVersionMapper.selectAppVersionByBaseId(baseId);
    }

    /**
     * 查询app版本列表
     *
     * @param appVersion app版本
     * @return app版本
     */
    @Override
    public List<AppVersion> selectAppVersionList(AppVersion appVersion)
    {
        return appVersionMapper.selectAppVersionList(appVersion);
    }

    /**
     * 新增app版本
     *
     * @param appVersion app版本
     * @return 结果
     */
    @Override
    public int insertAppVersion(AppVersion appVersion)
    {
        return appVersionMapper.insertAppVersion(appVersion);
    }

    /**
     * 修改app版本
     *
     * @param appVersion app版本
     * @return 结果
     */
    @Override
    public int updateAppVersion(AppVersion appVersion)
    {
        return appVersionMapper.updateAppVersion(appVersion);
    }

    /**
     * 批量删除app版本
     *
     * @param baseIds 需要删除的app版本主键
     * @return 结果
     */
    @Override
    public int deleteAppVersionByBaseIds(String[] baseIds)
    {
        return appVersionMapper.deleteAppVersionByBaseIds(baseIds);
    }

    /**
     * 删除app版本信息
     *
     * @param baseId app版本主键
     * @return 结果
     */
    @Override
    public int deleteAppVersionByBaseId(String baseId)
    {
        return appVersionMapper.deleteAppVersionByBaseId(baseId);
    }

    /**
     * @return
     */
    @Override
    public AppVersion getAppVersion() {
        List<AppVersion> appVersions = appVersionMapper.selectAppVersionList(new AppVersion());
        if(appVersions.isEmpty()){
            return new AppVersion();
        }
        return appVersions.get(0);
    }
}
